<h2 class="h2-title">Đơn đặt hàng !!!</h2>

<div class="clear"></div>
    <ul class="notification succ" id="ordermsg" style="display: none;">
        <li class="notifi_img"><img src="<?=base_url()?>assets/backend/css/images/icons/tick_circle.png"/></li>

        <li class="msg"><?=$this->native_session->flashdata('msg')?></li>

        <li class="close"><img src="<?=base_url()?>assets/backend/css/images/icons/cross_grey_small.png"/></li>

    </ul><!--End of .notification -->

<?php if($this->native_session->flashdata('msg')):?>
    <ul class="notification succ">
        <li class="notifi_img"><img src="<?=base_url()?>assets/backend/css/images/icons/tick_circle.png"/></li>

        <li class="msg"><?=$this->native_session->flashdata('msg')?></li>

        <li class="close"><img src="<?=base_url()?>assets/backend/css/images/icons/cross_grey_small.png"/></li>

    </ul><!--End of .notification -->
<?php endif?>

<table class="pretty">
                    <thead>
                        <tr>
                            <th>ID</th>
                            <th>Tên khách hàng</th>
                            <th>Thời gian đặt</th>
                            <th>Tổng tiền</th>
                            <th>Trạng thái</th>
                            <th>Chi tiết</th>
                            <th>Cập nhật</th>
                            <th>Xoá</th>
                        </tr>
                    </thead>

                    <tbody>
                        <?php if(isset($msg)):?>
                            <td colspan="8"><?= $msg ?></td>
                        <?php else:?>
                            <?php foreach($orders as $order):?>

                                <tr>

                                <td><?=$order->order_id?></td>
                                <td><?=$order->customer_name?></td>
                                <td><?=$order->order_date?></td>
                                <td>
                                    <?php if($order->order_total != 0):?>
                                        <?=number_format($order->order_total,0,",",".")?> đ
                                    <?php else:?>
                                        <?=number_format($order->total,0,",",".")?> đ
                                    <?php endif;?>
                                </td>
                                <td>
                                    <select name="order_status">
                                        <option value="0" <?php if($order->order_status == 0) echo " selected "; ?>>Chờ xử lý</option>
                                        <option value="1" <?php if($order->order_status == 1) echo " selected "; ?>>Hoàn thành</option>
                                        <option value="2" <?php if($order->order_status == 2) echo " selected "; ?>>Huỷ đơn hàng</option>
                                    </select>
                                </td>
                                <td>
                                    <a href="<?=base_url()?>backend/cart/detail/<?=$order->order_id?>" class="edit">
                                        <img src="<?=base_url()?>assets/backend/css/images/detail.jpg"/>
                                    </a>
                                </td>
                                <td>
                                    <a href="#update" class="updatecart" class="edit">
                                        <img src="<?=base_url()?>assets/backend/css/images/update.jpg"/>
                                    </a>
                                </td>
                                <td>
                                    <a href="<?=base_url()?>backend/cart/del/<?=$order->order_id?>" class="delete">
                                        <img src="<?=base_url()?>assets/backend/css/images/delete.png"/>
                                    </a>
                                </td>
                                <input type="hidden" name="order_id" value="<?=$order->order_id?>" />

                                </tr>

                            <?php endforeach;?>
                        <?php endif;?>
                    </tbody>
                </table>